package com.sharemarking.wa.platform.payconfig.wx;


import com.sharemarking.wa.platform.properties.WechatProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.InputStream;

/**
 * @author dxy
 */
@Component
public class MyWXConfig extends WXPayConfig {
    @Autowired
    private WechatProperties wrop;

    @Override
    String getAppID() {
        return wrop.getAppId();
    }

    @Override
    String getMchID() {
        return wrop.getMchId();
    }

    @Override
    String getKey() {
        return wrop.getMchKey();
    }

    public String getNotifyUrl() {
        return wrop.getNotifyUrl();
    }

    @Override
    InputStream getCertStream() {
        return null;
    }

    @Override
    IWXPayDomain getWXPayDomain() {
        IWXPayDomain iwxPayDomain = new IWXPayDomain() {
            @Override
            public void report(String domain, long elapsedTimeMillis, Exception ex) {

            }
            @Override
            public DomainInfo getDomain(WXPayConfig config) {
                return new IWXPayDomain.DomainInfo(WXPayConstants.DOMAIN_API, true);
            }
        };
        return iwxPayDomain;
    }

}
